<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ include file= "../blind/connect.jsp" %>
<%@ include file= "../blind/session.jsp" %>
<%
String year = request.getParameter("year");
String month = request.getParameter("month");
String day = request.getParameter("day");
String s_time = request.getParameter("s_hour") + ":" + request.getParameter("s_minute");
String e_time = request.getParameter("s_hour1") + ":" + request.getParameter("s_minute1");
String title = request.getParameter("title");
String position = request.getParameter("position");
String content = request.getParameter("content");

URL url = new URL(urll + "/event/write_ok.jsp");
HttpURLConnection httpCon = (HttpURLConnection) url
		.openConnection();
httpCon.setDoOutput(true);
httpCon.setRequestMethod("POST");
OutputStreamWriter outt = new OutputStreamWriter(
		httpCon.getOutputStream());

outt.write("year="+year+"&month="+month+"&day="+day
		+"&title="+title+"&s_time="+s_time+"&e_time="+e_time
		+"&position="+position+"&content="+content
		); 
outt.close();
InputStream inStrm = httpCon.getInputStream();
int ch;
String rslt = "";
while (((ch = inStrm.read()) != -1)) {
	char temp = (char) ch;
	String str = Character.toString(temp);
	rslt = rslt + str;
}
rslt = rslt.trim();
out.println(rslt);
System.out.println(rslt);
inStrm.close();

httpCon.disconnect();


/*
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/dbboard";
Connection conn = DriverManager.getConnection(url,"root","1234");
Statement stmt = conn.createStatement();

String strSQL = "INSERT INTO calendar (year,month,day,title,s_time,e_time,position,content) VALUES('";
strSQL = strSQL + year + "','";
strSQL = strSQL + month + "','";
strSQL = strSQL + day + "','";
strSQL = strSQL + title + "','";
strSQL = strSQL + s_time + "','";
strSQL = strSQL + e_time + "','";
strSQL = strSQL + position + "','";
strSQL = strSQL + content + "')";

stmt.executeUpdate(strSQL);

stmt.close();
conn.close();

*/
int imonth = Integer.parseInt(month);
response.sendRedirect("main.jsp?year=" + year + "&month=" + (imonth - 1));
%>
